﻿using System;
using System.Collections.Generic;
using System.ServiceModel;
using LLServer.Data;
using LLServer.Battle;

namespace LLServer
{
    [ServiceContract(Name = "ServicePortal", SessionMode = SessionMode.Required, CallbackContract = typeof(IPortalCallback))]
    public interface IPortal
    {
        [OperationContract]
        bool Connect(Client client);

        [OperationContract]
        int SignUp(User user, Captain captain);

        [OperationContract] // for testing only
        int AddCaptain(string captain_name);

        [OperationContract(IsOneWay = true, IsInitiating = false, IsTerminating = true)]
        void Disconnect();

        [OperationContract(IsOneWay = true, IsInitiating = false)]
        void Refresh();

        [OperationContract(IsOneWay = true, IsInitiating = false)]
        void RefreshInitAvailableUser();

        [OperationContract(IsOneWay = true, IsInitiating = false)]
        void SendMessage(string content);

        [OperationContract(IsOneWay = true, IsInitiating = false)]
        void SendWhisper(string target, string content);
        
        [OperationContract(IsOneWay = true, IsInitiating = false)]
        void Challange(string target);

        [OperationContract(IsOneWay = true, IsInitiating = false)]
        void RespondChallange(string target, bool respond);

        #region Battle Interface

        [OperationContract(IsOneWay = true, IsInitiating = false)]
        void ConfirmShipsPlacement(Client sender, Grid placement);

        [OperationContract(IsOneWay = true, IsInitiating = false)]
        void ReadyForBattle();

        [OperationContract(IsOneWay = true, IsInitiating = false)]
        void PauseBattle();

        [OperationContract(IsOneWay = true, IsInitiating = false)]
        void ResumeBattle();

        [OperationContract(IsOneWay = true, IsInitiating = false)]
        void Shot(Turn turn);

        [OperationContract(IsOneWay = true, IsInitiating = false)]
        void GetEnemyClientAndMe();

        #endregion

        #region Statistic Interface

        [OperationContract(IsOneWay = true, IsInitiating = false)]
        void GetStatistic();

        #endregion
    }
}
